{include file="common/head"}
</head>
<body >
<!--startprint-->
<div class="container-fluid" style="max-width: 800px;">
    <div class="text-center fs-4 mb-2">{$sys.company_name} 出入库单明细表</div>
    <div class="row" style="font-size: 1rem;">
        <div class="col">
            <div>单据编号：{$bill.bill_no}</div>
            <div>单据类别：{$bill.type_name}</div>
            <div>单据总数：{$bill.qty}</div>
            <div>单据件数：{$bill.pack_qty}</div>
        </div>
        <div class="col ">
            <div>制单人：{$bill.creater_name}</div>
            <div>制单时间：{$bill.create_time}</div>
            <div>审核人：{$bill.check_name}</div>
            <div>审核时间：{$bill.check_time}</div>

        </div>

    </div>

    <table class="table  table-hover table-bordered" >
        <thead class="table-info">
            <th>序号 sn</th>
            <th>产品 Name</th>
            <th>规格 Specs</th>
            <th>每件数量</th>
            <th>件数 Pack Qty</th>
            <th>单据数量 Qty</th>
            <th>单前库存</th>
            <th>单后库存</th>
            <th>备注 Memo</th>
        </thead>
        <tbody>
            {foreach $list as $k=>$kv}
            <tr>
                <td>{$k+1}</td>
                <td><div>{$kv['goods_id_name']}</div></td>
                <td>{$kv['specs_id_name']}</td>
                <td>{$kv['qty_per_pack']}</td>
                <td>x{$kv['pack_qty']}</td>
                <td>{$kv['qty']}</td>
                <td>{$kv['before_storage']}</td>
                <td>{$kv['after_storage']}</td>
                <td>{$kv['memo']}</td>
            </tr>
            {/foreach}

            <tr class="table-info">
                <td colspan="3"></td>
               
                <td>Total</td>
                <td>{$bill.pack_qty}</td>
                <td>{$bill.qty}</td>
                <td></td>
                <td></td>
                <td></td>
            </tr>
        </tbody>
    </table>




</div>
<!--endprint-->
<div class="text-center">
    <button class="btn btn-sm btn-primary" type="button" onclick="printpage();">
        <span class="bi-printer"></span> Print
    </button>
</div>

<div style="height:50px;text-align: center;color:#999"></div>
</body>

<script type="text/javascript">

  $(document).ready(function(){



  })

    function printpage(){
      let oldStr = window.document.body.innerHTML; // 获取body的内容
      let start = "<!--startprint-->"; // 开始打印标识, 17个字符
      let end = "<!--endprint-->"; // 结束打印标识
      let newStr = oldStr.substr(oldStr.indexOf(start) + 17); // 截取开始打印标识之后的内容
      newStr = newStr.substring(0, newStr.indexOf(end)); // 截取开始打印标识和结束打印标识之间的内容
      window.document.body.innerHTML = newStr; // 把需要打印的指定内容赋给body
      window.print(); // 调用浏览器的打印功能打印指定区域
      window.document.body.innerHTML = oldStr; // body替换为原来的内容
    }
</script>


</body>
</html>
